Skip to content

Conversation

k163377
Copy link
Contributor

@k163377 k163377 commented Sep 13, 2025

As a result of setting default arguments for all arguments, a no-argument constructor was generated, and an error occurred because multiple JsonCreator instances were defined.

As a result of setting default arguments for all arguments, a no-argument constructor was generated, and an error occurred because multiple JsonCreator instances were defined.
@k163377 k163377 merged commit 6428468 into FasterXML:2.x Sep 13, 2025
10 checks passed
@k163377 k163377 deleted the fix/#1051 branch September 13, 2025 16:00
@cowtowncoder
Copy link
Member

cowtowncoder commented Sep 14, 2025

Glad it's fixed, although I am bit surprised that 2 constructors were generated for data class?
(and both then got @JsonCreator annotation). Neither was declared as synthetic at JVM level (I was guessing 0-param might be but did not seem to).

EDIT: Ah. Description specifically said the problem is/was that when default arguments are used, there is need for 0-param constructor to support defaulting. This seems problematic wrt specifying annotations if/when they are duplicated... hmmh.

@cowtowncoder
Copy link
Member

Thinking about this further: it'd be good to know that in case of multiple constructors, some are secondary ones... but for now assumption has been that @JsonCreator must be explicitly selected. But somehow precedence needs to be established.

With JDK, there is the concept of "bridge" methods (Method.isBridge()) but same does not exist for Constructors unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Odd test failures after fixing databind issue 5045 (wrt default creator)
2 participants